package com.smartgame.screens;


import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputProcessor;
import com.smartgame.controllers.AbstractController;
import com.smartgame.controllers.MenuController;
import com.smartgame.renderers.AbstractRenderer;
import com.smartgame.renderers.MenuRenderer;
import com.smartgame.util.Assets;
import com.smartgame.util.AudioManager;

public class MenuScreen extends AbstractScreen {
	
	public MenuScreen(Game game) {
		super(game);
	}

	@Override
	public void render(float deltaTime) {
		super.render(deltaTime);
		
		if(Gdx.input.isTouched()) {
			AudioManager.instance.play(Assets.instance.sounds.sound);
			AudioManager.instance.play(Assets.instance.music.music);
			game.setScreen(new GameScreen(game));
		}
	}
	
	@Override
	public InputProcessor getInputProcessor() {
		return controller;
	}
	
	@Override
	public AbstractController createAbstractController() {
		if (controller == null) {
			controller = new MenuController(game);
		}
		return controller;
	}

	@Override
	public AbstractRenderer createAbstractRenderer() {
		if (renderer == null) {
			renderer = new MenuRenderer(controller);
		}
		return renderer;
	}

}
